package cn.appsys.controller.dictionary;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import cn.appsys.pojo.DataDictionary;
import cn.appsys.service.dictionary.DictionaryService;
import cn.appsys.tools.PageSupport;

/**
 * 字典表的控制器类
 * @author 寇超强
 *
 */
@Controller
@RequestMapping("/sys/dic")
public class DictionaryController {
	@Resource
	private DictionaryService dicService;
	/**
	 * 进入数据字典展示界面
	 */
	@RequestMapping(value="/showDictionary.html",method=RequestMethod.GET)
	public String showDictionary(Model model,
								String valueName,
								Integer currentPageNo,
								HttpSession session){
		PageSupport page=new PageSupport();
		if(currentPageNo==null)
			currentPageNo=1;
		if(currentPageNo>0)
		session.setAttribute("valueName", valueName);
		page.setCurrentPageNo(currentPageNo);
		List<DataDictionary> dictionaryList= dicService.getDicInfo(valueName,page);
		model.addAttribute("dicList",dictionaryList);
		model.addAttribute("page",page);
		return "backend/showDictionary";
	}
}
